package com.huawei.java.util;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class FileUtils {

    public static List<String[]> readCSV(String path) {

        List<String[]> result = new ArrayList<>();

        String line = "";
        String cvsSplitBy = ",";//使用逗号来作为separator

        try (BufferedReader br = new BufferedReader(new FileReader(path))) {

            while ((line = br.readLine()) != null) {
                String[] column = line.split(cvsSplitBy);
                result.add(column);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }

    public static Integer scanQosConstraint(){
        Properties props = new Properties();
        try {
            BufferedReader br = new BufferedReader(new FileReader("/data/config.ini"));
            props.load(br);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Integer.valueOf(props.get("qos_constraint").toString());
    }



}